export default {
  addCart(context, payLoad){
    return new Promise(resolve => {
      let oldProduct = context.state.cartList.find(item => item.iid === payLoad.iid)
      if(oldProduct){
        context.commit('addCount', oldProduct)
        resolve('数量增加成功')
      }else{
        context.commit('addToCart', payLoad)
        resolve('加入购物车成功')
      }
    })
  }
}